<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>3D旋转</title>
</head>
<body>
  <style>
    div{
      width:200px;
      height:200px;
    };
    box{
      position:relative;
    }
    .box div{
      position:absolute;
      transform-style:preserve-3d;
      transition:all 2s;
      backface-visibility:hidden;
    }
    .div1{
      background:red;
      z-index:2;
      transform:rotateY(0deg);
      text-align:center;
      line-height:200px;
      color:white;
      font-size:24px;
    }
    .div2{
      background:blue;
      z-index:1;
      transform:rotateY(-180deg);
      text-align:center;
      line-height:200px;
      color:white;
      font-size:24px;
    }
    .box:hover .div1{
      transform:rotateY(-180deg);
    }
    .box:hover .div2{
      transform:rotateY(0deg);
    }
  </style>
  <div class="box">
    <div class="div1">正面</div>
    <div class="div2">反面</div>
  </div>
</body>
</html>
